<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>用户编辑</title>
    <link th:href="@{/static/bootstrap/css/bootstrap.min.css}" rel="stylesheet"/>
</head>
<body>
<div class="container">
    <div class="row" style="margin-top: 10px">
        <form class="col-sm-10 col-sm-offset-1" th:action="@{/user/edit}" method="post">
            <div class="form-group">
                <label >登陆名</label>
                <input type="text" class="form-control" name="name" th:value="${user.name}" disabled="disabled"/>
            </div>
            <input type="text" name="id" th:value="${user.id}" hidden="hidden"/>

            <div class="radio">
                <label>
                    <input type="radio" id="noLock" name="locked" th:checked="${user.locked==1}" value="1"/>
                    不锁定
                </label>
            </div>
            <div class="radio">
                <label>
                    <input type="radio" id="lock" name="locked" th:checked="${user.locked==0}" value="0"/>
                    锁定
                </label>
            </div>

            <div class="form-group">
                <label for="nickname" class="control-label">用户名</label>

                <input type="text" class="form-control" id="nickname" name="nickname" placeholder="用户名" th:value="${user.nickname}"/>

            </div>

            <div class="form-group">
                <label class="control-label">选择分组</label>
                <select name="group.id" class="form-control">
                 <span th:if="${user.group!=null}">
                    <option th:value="${user.group.id}" th:text="${user.group.name}"></option>
                 </span>
                    <option th:each="g:${groups}" th:value="${g.id}" th:text="${g.name}"></option>
                </select>
            </div>

            <div class="form-group">
                <label class="control-label">选择角色</label>
                <select name="role.id" class="form-control">
                    <option th:if="${user.role!=null}" th:value="${user.role.id}" th:text="${user.role.name}"></option>

                    <option th:each="r:${roles}" th:value="${r.id}" th:text="${r.name}"></option>
                </select>
            </div>
            <button type="submit" class="btn btn-primary btn-block">提交</button>
        </form>
    </div>
</div>
</body>
</html>